<html>
  <head>
    <link rel="stylesheet" type="text/css" href="extjs/resources/ext-theme-neptune/ext-theme-neptune-all.css">
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <script type="text/javascript">
    
      var CLIENT_ID = '513211258110.apps.googleusercontent.com';
      var SCOPES = 'https://www.googleapis.com/auth/drive';

      function handleClientLoad() {
        window.setTimeout(checkAuth, 1);
      }

      function checkAuth() {
        gapi.auth.authorize(
            {'client_id': CLIENT_ID, 'scope': SCOPES, 'immediate': true},
            handleAuthResult);
      }

      function handleAuthResult(authResult) {
        if (authResult && !authResult.error) {
          window.location = '/index.html';
        }
      }

    </script>
    <script type="text/javascript" src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
    <script type="text/javascript" src="extjs/ext-all.js"></script>
    <script type="text/javascript">
    Ext.application({
    		requires:['Ext.container.Viewport','Ext.button.Button','Ext.panel.Panel'],
            name: 'BookmarkIt',
            controllers:['BookmarkController'],
            launch: function() {
            	
                    Ext.create('Ext.container.Viewport', {
                        layout: {
                            type: 'border'          
                        },
        				minWidth:460,
                        autoScroll:false,
                        autoShow:true,
                        items: [{
                            region: 'center',
                            xtype: 'panel',
                            style : {
                            	'text-align' : 'center'
                            },
                            items: [{
                            	xtype : 'panel',
                                title : 'Welcome to the EasyBookmarks application.This application uses Google Docs to store your bookmarks. Press authorize button to continue',
                            },
                            {
                            	xtype : 'button',
                            	id : 'authorizeButton',
                            	text : 'Authorize',
                            	style : {
                            		'margin-top' : '10px'
                            	},
                            	handler : function(){
                                    gapi.auth.authorize(
                                            {'client_id': CLIENT_ID, 'scope': SCOPES, 'immediate': false},
                                            handleAuthResult);
                            	}
                            }]
                        }

                        ]
                   
                    });
            }
    });
    </script>
  </head>
  <body>
    <input type="file" id="filePicker" style="display: none" />
  </body>
</html>